# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Jan-Erik Rediger <badboy at archlinux dot us>

pkgname=bash-bats-support
pkgver=0.3.0
pkgrel=3
pkgdesc="Supporting library for Bats test helpers"
arch=("any")
url="https://github.com/ztombol/bats"
license=("custom:CC0")
depends=('bash-bats')
source=("$pkgname-$pkgver.tar.gz::https://github.com/ztombol/bats-support/archive/v$pkgver.tar.gz")
sha512sums=('417a8054462a44a6f46e375526cc1c920bae54ea76ddec3ff46603fe68bdb5c58f51bfb1c7e066347a3b71ff4d43986fd5157eb55151e0c4b5d189d81282ea14')

check() {
  cd bats-support-$pkgver
  bats test
}

package() {
  cd bats-support-$pkgver

  for fn in *.bash; do
    install -Dm755 $fn \
      "$pkgdir"/usr/lib/bats-support/$(basename $fn)
  done

  for fn in src/*.bash; do
    install -Dm755 $fn \
      "$pkgdir"/usr/lib/bats-support/src/$(basename $fn)
  done

  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
